Image recognition method using two-dimensional stochastic grammars

ABSTRACT

A method of automatically identifying bitmapped image objects. Each of a set of templates in an object template library is compared with all areas of like size of a bitmapped image. A set of signals is generated for each such comparison that satisfies a defined matching criteria between the template and the image area being compared. The set of signals identifies the object based on the matching template, the location of the object in the image and an indication of the goodness of the match between the object and the template. A series of possible parse trees are formed that describe the image with a probability of occurrence for each tree. Each parent node and its child nodes of each parse tree satisfies a grammatical production rule in which some of the production rules define spatial relationships between objects in the image. The one of the possible parse trees which has the largest probability of occurence is selected for further utilization.

TECHNICAL FIELD

The invention relates to the field of pattern recognition in general and, in particular, to the field of bitmapped image recognition.

BACKGROUND OF THE INVENTION

Formal grammars have been used in the past in linguistics and computer science, where, for example, basic parsing algorithms have been developed. By formal grammars, it is meant the set of rules which define the allowable formats (syntax) that statements in a language in question are allowed to take. Grammers may be characterized as unrestricted, context-sensitive, context-free, and regular. The formal definitions of these four classifications are discussed in the detailed description of the invention. By parsing, it is meant the partitioning of a grammatical statement into its constituent parts to aid the automatic interpretation of a statement by a computer or other means. For example, the Cocke-Younger-Kasami parsing algorithm, described in INTRODUCTION TO AUTOMATA THEORY, LANGUAGES, AND COMPUTATION by Hopcroft and Ullman; Addison-Wesley, 1979; has become a standard parsing tool. The notion of grammars with attributes is developed in a paper SEMANTICS OF CONTEXT-FREE LANGUAGES by Knuth; Journal of Mathematical System Theory; 2:127-146; 1968. High dimensional grammars, of which two-dimensional grammars is a special case, have been studied for use in pattern recognition in general. An example of such a study is SYNTACTIC PATTERN RECOGNITION AND APPLICATIONS; K. S. Fu; Prentice-Hall; 1982 . Stochastic regular grammars as used in speech recognition may be attributed to J. K. Baker; THE DRAGON SYSTEM; IEEE TRANSACTIONS ON ACOUSTIC SPEECH AND SIGNAL PROCESSING; ASSP 23:24-29; 1975 and STOCHASTIC MODELING AS A MEANS OF AUTOMATIC SPEECH RECOGNITION; PhD Thesis; Carnegie-Mellon University; 1975. Stochastic, as used here, refers to the use of probabilities associated with the possible parsing of a statement to deal with real world situations characterized by noise, distortion and uncertainty. Stochastic context-free grammars for speech recognition have also been proposed by Baker in his paper TRAINABLE GRAMMARS FOR SPEECH RECOGNITION, Speech Communication Papers of the 97th Meeting of ASA, MIT, Cambridge, Mass., Jun. 12-16, 1979 though in practice little has been done in this area.

Some of the principles developed in the pattern recognition field have been suggested for printed object recognition. For example, the use of two-dimensional nonstochastic context-free grammars for recognizing printed equations is suggested by R. H. Anderson in chapter 7 of K. S. Fu, ed. SYNTACTIC PATTERN RECOGNITION; pp 147-177; Springer-Verlag; Berlin, 1977. W. W. Stallings has also suggested in Chapter 5 of the same book the principle of using similar two-dimensional techniques for the recognition of printed Chinese characters.

Commerical optical character recognition systems are also available for scanning documents containing graphics characters and for converting the scanned objects into the undelying text. Such systems, as far as is known, are primarily intended to produce a string of text without any understanding of the meaning of the text. Instead, such known systems appear to be arranged to select the most probable character or object, on an object-by-object basis. It is believed that some of these systems use stochastic principles in some fashion to assist the selection of the most likely objects. However, the systems do not distinguish titles, abstracts, footnotes, body text etc. in a document. If intelligent recognizers can be made that are able to distinguish the underlying structures of documents, then much more intelligent object recognition systems will become possible. Such an improved system would be able to parse the underlying graphical material and then, for example, search the material on a context basis. For example, an intelligent recognizer might parse a document from an image of the document, locate an abstract of the document and search the abstract for a given phrase. As further examples, graphical equations and tables could be parsed and approriate text automatically generated for subsequent formatting and printing in other documents under the control of document formatting systems such as TeX and NROFF.

SUMMARY OF THE INVENTION

An advance is made in the art of image recognition in a method of identifying bitmapped image objects. Each of a set of templates in an object template library is compared with all areas of like size of a bitmapped image contained in a file. A set of signals is generated for each such comparison that satisfies a defined matching criteria between the template and the image area being compared. The set of signals identifies the object based on the matching template, the location of the object in the image and an indication of the goodness of the match between the object and the template. A series of possible parse trees are formed that describe the image with a probability of occurrence for each tree. Each parent node and its child nodes of each parse tree must satisfy a grammatical production rule in which some of the production rules define spatial relationships between objects in the image. The one of the possible parse trees which has the largest probability of occurrence is selected for further utilization. In the preferred embodiment, the set of grammatical production rules define a context-free grammar. Each object identified by each set of signals is tested with each other such object, including the spatial constraints associated with the objects, to determine if the combination of such objects results in a new object that satisfies the production rules. If this test is successful, the probability of the existence of the combined object in the image is generated and the new combined object is included as a possible parsing of the image, along with its probability of occurrence. After the above process is completed, the probabilities associated with each production rule and the probability of a pixel being in error in the image file may, if desired, be reestablished from the results obtained during the image recognition process. The stochastic nature of the method enables the treatment of both noise and ambiguity in a unified framework for recognition and performance can be improved by the reestablishment of the production probabilities and pixel error probabilities. The use of stochastic context-free grammars in document recognition easily handles noise, ambiguity, and touching objects. Complex two-dimensional structures, such as document layouts, tables and equations, are also easily handled.

BRIEF DESCRIPTION OF THE DRAWING

In the drawing, FIG. 1 shows one example of the use of an intelligent image recognition system to parse equations and to generate script files for the subsequent formatted printing of the equations using NROFF notation;

FIG. 2 shows the primary components of an illustrative intelligent object recognition system, a lexical analyzer operating in conjunction with a library of graphical object templates and a parser operating in conjunction with a set of grammatical rules;

FIG. 3 shows an illustrative layout of a cumulative distribution file used to convey the spatial density of black pixels in an object recognized as part of a document under parsing;

FIGS. 4 through 10 show illustrative flowcharts of the parser and related teaching aids;

FIG. 11 shows a table PHRASELIST containing all objects determined to be possible parses of an example equation E=mc sup 2 contained in a bitmapped image file; and

FIGS. 12 and 13 show parse trees of two of the objects contained in PHRASELIST.

DETAILED DESCRIPTION

FIG. 1 illustrates one system that makes use of the invention to convert an image of an equation into a form for printing with a document formatter. For illustration only, this example assumes that document production is accomplished with the NROFF formatting program that is usually associated with the UNIX (R) operating system available from AT&T. Therefore, the illustrative output of the system of FIG. 1 at 108 is a file in NROFF format. In this example, a document 100 contains a graphical representation of the equation E=mc². A bitmapped binary image file 104 is generated from this hardcopy image by means of any suitable scanning device 102. This bitmapped file is inputted into any suitable computer 106 programmed in accordance with the disclosure below to produce the output file 108 for further formatted document production. In one illustrative embodiment, a mainframe Alliant FX/80 computer has been used satisfactorily for computer 106.

In NROFF format, formatting for an equation is indicated in a document by embedding on a line by itself the control sequence ".EQ" This is shown at 110 of the file 108. An equation is ended by similarly embedding the control sequence ".EN", as shown at 112. The commands specifying the equation to be generated is set out using other appropriate commands between the .EQ and .EN control sequences. The command for the original equation E=mc sup 2 is shown at 114. Here, the tilde "˜" characters are used to tell the NROFF formatter to insert spaces before and after the equal sign. The phrase "sup 2" informs the formatter that the character "2" is a power superscript modifying the previous character "c". When the NROFF formatter is executed with the file 108 as its input, it produces another printer control file (not shown), which contains the actual data specific to the printer 116 at hand to cause it to print the equation as a page 118 in a selected font and typesize.

Computer 106 is programmed to perform the intelligent object recognition function required for the example of FIG. 1. Flowcharts of the algorithm are shown in FIGS. 4 through 9. For completeness, a listing of the source code is included in the Appendix. This source code is written in the language C++. C++ is readily understood by any programmer skilled in this language and will therefore not be described in detail. The C++ language is described in detail in a number of available books, including the book C++, Bjarne Stroustrup, Addison Wesley, 1986.

The elements shown in FIG. 2 are program elements which are executed on the computer 106. The binary image file representing a document on which object recognition is to be performed is inputted to a lexical analyzer 200, whose function is to generate a list of all possible objects in the image file. The operation of the analyzer is straight forward and no detailed flowchart is provided. A template library 202 is provided which contains a number of n x m bitmapped templates of all of the image objects of possible interest for the task at hand. The analyzer 200 compares each n x m area of the image file to each n x m template to discover a possible match. A match is defined as a comparison in which the number of matching pixels between the image area being compared and the template exceed a predetermined threshold. Each such possible match is outputted from the analyzer 200 as a entry in a sequential list. Each such possible match entry in the list includes other information, such as an identification of the corresponding object (the template), the x and y coordinates of the location in the image file of the object, a measure of the probability that the object corresponding to the template is indeed present in the image file and other attributes of the object such as pointsize. The probability is determined by the number of matching pixels in the image relative to the number of mismatching pixels. The analyzer 200 also generates a cumulative distribution file (CDF) for the image file. The CDF is a file of the same dimensions i x j as the image file, where i and j refer to x and y pixel coordinates of the image file. Each entry of CDF, corresponding to each pixel of the image file, contains a count C of the number of black pixels in a rectangle of the image file illustratively bounded by the pixel coordinates 0,0 and i,j, as shown in FIG. 3. Both the list of possible objects and the CDF are inputted to the parser 204, which is next described. Also available to the parser is a set of production rules 206 that define the grammar for the problems at hand.

The beginning of the parser 204 is a procedure called MAIN, shown in FIG. 4. Step 400 of MAIN initially calls a subroutine READCDF to read in the CDF file. Step 402 calls a subroutine READLEX which reads the list of possible objects generated by the analyzer 200 into the first row of an array PHRASELIST, shown in FIG. 10. Step 404 next reads in a set of rules that define the context-free grammar that governs this execution of the parser. As an aside, these rules for equation recognition are built-into the C++ code included in the Appendix. However, for general operation, it is preferable to load different sets of rules for differing applications. The illustrative grammatical rules for the illustration at hand, equation recognition, are as follows:

1. S→<Expression>

2. <Expression>→<Expression>:<Factor>

3. <Expression>→<Factor>

4. <Factor>→<ExpressionOverExpression>

5. <Factor>→<Symbol>

6. <Factor>→<ExpressionBigOpExpression>

7. <Factor>→<SymbSupSub>

8. <ExpressionOverExpression>→<Expression>/<OverExpression>

9. <OverExpression>→<Over>/<Expression>

10. <ExpressionBigOpExpression>→<Expression>/<BigOpExpression>

11. <BigOpExpression>→<BigOp>/<Expression>

12. <SymbSupSub>→<Symbol>:<SupScript>

13. <SymbSupSub>→<Symbol>:<SubScript>

14. <SymbSupSub>→<Symbol>:<SupSubScript>

15. <SupScript>→<Expression>

16. <SubScript>→<Expression>

17. <SupSubScript>→<Expression>/<Expression>

Here, the start symbol S represents the expression in the entire image file itself. One example of such an image might be the equation ##EQU1## Such an <Expression> in turn represents either another <Expression> followed horizontally by a <Factor> (here, ##EQU2## or a <Factor> by itself. A <Factor> in turn, is a nonterminal representing an expression that cannot be horizontally subdivided, such as a fraction ##EQU3## an elementary symbol (=), a big operator ##EQU4## or an elementary symbol that has been subscripted or superscripted (π²). A nonterminal is an expression on the left-hand side of a grammatical production rule and that may correspond to one or more objects in the image. A terminal in linguistics in general is considered to be a word that appears in a sentence that cannot be further grammatically decomposed. In the context of the invention, a terminal refers to a pixel of the image, as will become clear. The remaining production rules listed above map <Factor> to one of these alternatives. <Over> refers to a horizontal bar, as in a division operator, for example. <BigOp> refers to a set of mathematical operators. Such a set might include the operators for integration, summation, logical union and intersection, etc. The colon (:) in the rules indicates horizontal concatenation of expressions while the slash (/) indicates vertical concatenation. Each rule, although not shown, has associated with it spatial constraints governing its applicability. Thus, for example, the rule <ExpressionOverExpression>=<Expression>/<OverExpression> has spatial constraints describing how close <Expression> must be to <OverExpression> in order for this rule to apply to a given set of objects. In addition, each rule has stored with it (not shown) a format for eventually generating an output conversion. In this example, the output conversion is a text string for the NROFF formatter. Thus, for example, the format associated with rule 2 is simply $1$2, where $1 and $2 are variables to be replaced with text describing the objects that are mapped by this rule. As another example, the format stored with rule 12 is {$1} sup {$2}, where sup is the NROFF command for superscript. The brackets "{" and "}" stored in the format tell the NROFF formatter to treat as a unit everything within the brackets, e.g. the text describing the superscript $2.

In addition to the above rules, there are production rules for mapping the nonterminal <Symbol> to each of 152 nonterminal objects, representing the following letters: Roman 7 and 10 point digits 0-9, Italic 7 and 10 point lower case letters a-z, Greek 7 and 10 point lower case letters α-ζ, and special 7 and 10 point mathematical symbols ≠, ±, →, ==>, ←, <==, ≡, ≈, =, ∇, ∞, ∫, +, -,/, and |. There are also production rules for mapping the nonterminal <Over>to nonterminal objects representing 7 point horizontal lines, and for mapping the nonterminal <BigOp> to nonterminal objects representing one of the five 15 point "big operators" Σ, π, ∪, ∩, and ∫. The nonterminal objects, in turn, are mapped to rectangular arrays of pixels, which are derived from the templates in the library 202. Thus pixels, and not characters, are the terminal symbols in this grammar. The entire image file is a sentence, whose parse specifies a hierarchical structure all the way down to the pixel level.

The probability that an object maps to a template can be calculated by the Hamming distance between the pixels of the object and the template. For example, for an n x m template, any n x m area of an image file differing from the template in d places has probability P_(e) ^(d) (1-P_(e))^(N-d). Indeed, the Hamming distance d is binomially distributed with parameters N and P_(e), and hence has mean NP_(e) and variance NP_(e) (1-P_(e)). Using the normal approximation to the binominal (Demoivre-Laplace or Central Limit Theorems), the probability that the number of errors d is further than three standard deviations from the mean is small. Hence all productions that map a character to a bitmap with more errors than three times the standard deviation from the mean are treated as non-matching. This is called the three sigma rule}. Other noise models, such as Markov random fields, could also be satisfactorily used.

Thus, in the illustrative embodiment, the lexical analyzer 200 performs the pattern matching between the templates and the image, and applies the three sigma rule to derive a list of all objects that may appear with significant probability in the image, and their locations. Additional information placed in the list may include character height and width, probability, pointsize, baseline, and textual representation, as well as other attributes.

With reference again to step 402 of FIG. 4, the list of all possible objects from the lexical analyer is entered into row 1 of the array PHRASELIST. An example of PHRASELIST for the present example is shown in FIG. 11 for the example E=mc sup 2. The results of filling row 1 with all possible objects is shown. Reading from left to right in row n=1, the possible objects there entered from step 402 (depending upon the quality of the image) are shown. For purposes of illustration, it is assumed that the top horizontal extender of the object "E" is somewhat disconnected by noise from the rest of the body of the "E". Therefore, this part of the "E" might be treated by the analyzer 200 as a possible separate object in its own right if a template matches with sufficient probability. This accounts for the "-" shown at 1104 as a possible object. The possible objects at 1106 and 1108 correspond to the separate elements of the object "=". The remaining possible objects in row 1 of PHRASELIST are self-explanatory.

Next, the parser begins to populate the remaining rows of PHASELIST with combinations of new objects taken from all that have already been identified and that satisfy the grammatical rules with sufficient probability. This is accomplished in a nested two-stage loop shown in steps 406 through 420. Step 406 sets the outside loop counter n to 2. The inside loop counter m is set to 1 in step 408. At 410, a procedure OUTWARD is called to populate PHRASELIST(n) with objects combined from objects in PHRASELIST(m) and objects in PHRASELIST(n-m). Then m is incremented at 412 and tested at 414 to determine if the inner loop is completed. When the inner loop is completed, PHRASELIST(n) will contain all grammatically legal combinations of n objects. At step 416 n is incremented and the above process repeated until all rows have been populated up to the length of the object list N in row 1. Thus, on the next (second) pass when n=3 and m=1, OUTWARD combines all possible objects in PHRASELIST(1) with all objects in PHRASELIST(2) and then, when n=3 and m=2, combines possible objects in PHRASELIST(1). The new possible objects are entered into PHRASELIST(3), and so on. Thus, the effect of steps 406 through 420 is to find and enter in an appropriate row of PHRASELIST all objects that can be combined from other objects in PHRASELIST according to the grammatical rules.

For the example at hand, the completely populated PHRASELIST is shown in FIG. 11. Please remember that each object entry also contains other associated information, such as the probability of its actual occurrence (prob) and a pointer (rule) which points to the production rule that was used to generate the entry, etc., although this information is not shown except in the row 1 entry at 1100. During the population of PHRASELIST row I, the concatenation of the somewhat disjointed top horizontal extender of the object "E" at 1104 of row 1 will not be found to match any other object according to the grammatical rules with sufficient probability to warrant the inclusion of a combination with any other possible object. Therefore, no entry in the remaining rows of PHRASELIST includes any such combination. In row 2, the object at 1102 results from the combination of "E" with the top horizontal element of "=". The object at 1104 results from the combination of "E" with the bottom element of "=". Both of these new possible objects result because the combination spatially and probelmatically satisfies (it is assumed) rule 2 above, as does the objects "=m" and "mc" in 1106 and 1108, respectively. The last object c² in 1110 satisfies rules 2,3 and 7. The remaining objects in FIG. 11 are arrived at in the same manner as those already discussed.

Details of OUTWARD are shown in FIGS. 8 and 9. Steps 800 through 804 inconjunction with steps 900 through 910 set up a three stage nested loop in which said present object in PHRASELIST is combined with valid other objects in PHRASELIST in accordance with the above discussion. The innermost loop tests each object combination with each rule. The remaining two outer loops control the selection of each possible object combination to be tested. Step 806 in the inner loop determines if the present combination (ab in FIG. 8) being examined satisfies the grammatical and spatial constraints of a rule r. If not, the combination is eventually discarded after all rules have been tested. If any rule is satisfied, step 808 is executed. Step 808 determines the parent object s for the present combination ab. The parent object for PHRASELIST row 2, 1100 "E=", and PHRASELIST row 1, 1110 ("m"), for example, is PHRASELIST row 3, 1100 ("E=m"). With the parent determined, steps 810 and 812 determine from an analysis of the probabilities associated with white space surrounding the individual objects whether or not this new combination should be included in PHRASELIST. To accomplish this, the notion of a bounding box is associated with each object a, b and s, as shown in FIG. 10. Bounding boxes originally are determined by the area associated with the templates of library 202. As objects are combined, the minimum and maximum extents of the x and y coordinates of the combined object determines a new bounding box for the new object. In step 810, the total whitespace k in the box for object s is calculated as the total area of the s box minus the box areas for a and b. The number of black pixels d in this whitespace is calculated using the number of black pixels in the boxes for s, a and b. The probability that what appears to be whitespace in the object s, as calculated above, is indeed whitespace is determined by the equation

    wsprob(s)=p.sup.d (1-p).sup.(k-d),

where p is an empirically determined probability that one pixel is in error. Then, from all the patterns, including noise, that might be interpreted as s, the probability of the actual pattern observed, outprob(s), is determined by the equation

    outprob(s)=prob(r)*outprob(a)*outprob(b)*wsprob(s).

Here, outprob(a) refers to the probability associated with an object in row 1 of PHRASELIST that is determined from template matching or from a previously calculated outprob(s) for the combination of some objects in the remaining rows of PHRASELIST.

Step 812 determines if outprob(s) from step 810 is greater than a threshold

    threshold=p.sup.d' (1-p).sup.(k'-d'),

where k' equals the area of the bounding box associated with s and d' is determined by the equation ##EQU5##

If this threshold is exceeded, this means that the object is sufficiently likely to be part of the original image. In this case, the new object combination is added to PHRASELIST at step 814.

Once PHRASELIST is completely populated, every possible object contained therein represents a possible parsing of the correct image with some probability outprob(s) that it is correct, and each such object is associated with a parse tree. The example parse tree of FIG. 12 represents the tree for the object contained in row 3, 1102 of PHRASELIST and FIG. 13 is the tree for the object of row 5, 1100. It remains now to compute the probabilities for each parse tree and to select the most probable parsing as the correct representation of the image. Step 500 of FIG. 5 performs this function. For each object in PHRASELIST, k is set equal to the area of the original image outside the bounding box for the object s under consideration. d is set to the number of black pixels outside of the bounding box for s. Inprob(s) is the probability that, given the object s within the bounding box, the exact pixel pattern outside the bounding box was observed. Inprob(s) is then

    inprob(s)=p.sup.d (1-p).sup.(k-d)

where p is again the probability of a pixel error. Under the assumption that this object is the only object in the original image, the probability that this object is the correct parsing of the image is found by

    prob(s)=outprob(s)*inprob(s).

After the probabilities for all the objects have been calculated, step 502 selects the parse tree with the largest probability prob(s) as the correct parsing. This should be the tree shown in FIG. 13 for the example at hand, although, in principle, noise considerations could make an earlier combination the most probable.

Step 504 illustrates one example of how the prior results might be utilized. As was mentioned, the example here assumes that a script file is to be generated that when inputted to the NROFF formatter of the UNIX system, will generate a printed output of the equation contained in the image. To accomplish this, step 504 breaks the root of the selected parse tree into its children a and b, which in the preferred embodiment is always two because of the two element form of the grammatical rules on their right-hand side. The production rule r that mapped the root into the two children is also selected. The format stored with the rule contains text, in the example at hand, and it may contain substitution operators which are variables standing for a textual description of the objects associated with the child nodes. Such variables are the $1 and $2 in step 504. The result of substituting the textual description of a variable in the format and outputting the format is shown, for example, at step 108.

The remaining steps 606 through 620 and 700 through 702 are not necessary for an understanding or practice of the invention. However, they are included here and in the Appendix for completeness. These steps retrain the probabilities associated with the templates in the library 202, according to the results derived in the present example. To do this, the combinations of objects in rows greater that 1in PHRASELIST must be decomposed and the probabilities associated with each decomposed object recomputed.

The remaining steps 606 through 620 and 700 through 702 establish a training mode, in which the results of the recognition steps 400 through 420 and 500 through 504 are used as data to retrain the system. Specifically, steps 606 through 620 compute, for each object s, the value of inprob(s), which is the probability of the image outside the bounding box of s, given the object s. The details of how this computation is performed are given shortly. For each object s, step 700 multiplies inprob(s) by outprob(s) to obtain the probability that the object s appears in the image within its bounding box. This probability is accumulated in count(r), where r is the production rule used to construct s from its component objects. Thus, count(r) becomes the expected number of times each production rule r is used in some parse tree of the image. Every image recognized while the system is in this training mode contributes to count(r) in this way.

Step 701 computes a new probability for of a pixel being in error. This is done by comparing the objects in PHRASELIST with the original image, and accumulating the probability of a pixel error according to the equation

    count(p)=count(p)+inprob(s)*outprob(s)*k

where k is the number of bit errors in the image within the bounding box of s for objects in PHRASELIST(1) and within the whitespace areas of objects in PHRASELIST(2) through PHRASELIST(N). The elimination of all but the whitespace areas for the objects outside of PHRASELIST(1) prevents multiply counting errors associated with the objects already included from PHRASELIST(1).

When the training mode is terminated step 702 normalizes the counts, and sets the production probability prob(r) to count(r) for each production rule r. It also updates the pixel error probability.

Steps 606 through 620 compute inprob(a) by summing the quantity

    prob(r)*inprob(s)*wsprob(s)*outprob(b)

over all objects s and b such that s is composed of a and b via the production rule r. In this formula, since inprob(s) must be computed before inprob(a), inprob(a) is accumulated in decreasing order of n, where n is the number of atomic objects comprising s. The outer loop 606, 618, and 620 control the decreasing order of n. The inner loop 608, 610, 614, and 616 steps through each object is composed of n atomic objects. Step 612 performs the actual accumulation of inprob(a).

It is to be understood that the above described arrangments are merely illustrative of the application of principles of the invention and that other arrangements may be devised by workers skilled in the art without departing from the spirit and scope of the invention. ##SPC1## 

I claim:
 1. A method of identifying bitmapped objects of an image comprising the steps of:comparing the templates in an object template library with all areas of like size of the image, generating a set of signals for each such comparison that satisfies a defined matching criteria between the template and the image area being compared, said set of signals identifying the object based on the matching template, the location of the object in the image and an indication of the goodness of the match between the object and the template, forming a series of possible parse trees of the image with a probability of occurrence for each tree, wherein each parent node and its child nodes of each parse tree satisfies a grammatical production rule, in which certain ones of the production rules define spatial relationships between objects in the image, and selecting one of the possible parse trees having the largest probability of occurrence for further utilization.
 2. The method of claim 1 further comprising the step of identifying a set of grammatical production rules before the step of forming the possible parse trees.
 3. The method of claim 2 wherein the set of grammatical production rules define a context-free grammar.
 4. The method of claim 1 or claim 3 wherein the parsing step further comprises:testing each object identified by each set of signals with each other such object, including the spatial constraints associated with the objects, to determine if the combination of such objects results in a new object that satisfies the production rules and, if so, calculating the probability of the existence of the combined object in the image, and including the new combined object and its probability as a possible parsing of the image.
 5. The method of claim 4 wherein the probability of an object formed by combining objects a and b is calculated from the formula

    outprob(s)=prob(r)*outprob(a)* outprob(b)*wsprob(s),

where prob(r) is a probability associated with the production rule governing the combination of a and b, outprob(a) and outprob(b) are the probabilities of the existence of objects a and b in the image, as determined from a template, or outprob(s) and wsprob(s) is determined by the equation

    wsprob(s)=p.sup.d (1-p).sup.(k-d),

wherek is the area of apparent whitespace in a bounding box for the combined object s, d is the number of black pixels in this whitespace, and p is an empirically determined probability that one pixel in the image is in error.
 6. The method of claim 1 further comprising the step of reestimating the probabilities associated with each production rule from the set of possible parse trees.
 7. The method of claim 1 further comprising the step of reestimating the probability of a pixel error. 